<?php
	require_once './admin.function.php';

	$action = $_REQUEST['action'];
	
	echo '<div><a href="/">Back</a></div><br/>';
	
#----------------------------------------------------------------------
	if($action == 'addpage') {
		$pageName = $_REQUEST['name'];
		$filesCreated = addPage($pageName);
		
		echo '<br />Files created successfully: '.implode($filesCreated, ',');
	}

#----------------------------------------------------------------------
	if($action == 'showfieldslist') {
		$pageName = $_REQUEST['table'];
		$fields = getFields($pageName);
		var_dump($fields);
	}
	
#----------------------------------------------------------------------
  if($action == 'getfranceregionstowns') {
    getFranceRegionsTowns();
    
    echo '<br />Get the France\'s regions and towns finished.';
  }
  
#----------------------------------------------------------------------
  if($action == 'importfranceregionstowns') {
    importFranceRegions();
    importFranceTowns();
    
    echo '<br />Import the France\'s regions and towns finished.';
  }
  
#-----------------------------------------------------------------------
  if($action == 'importcategories') {
    importCategories();
    
    echo '<br />Import categories.';
  }
  
#------------------------------------------------------------------------
  if($action == 'gencategoriescache') {
    genCategoriesCache();
    
    echo '<br />Generate categories cache successfully.';
  }
  
#-------------------------------------------------------------------------
 if($action == 'genregionstownscache') {
   genRegionsTownsCache();
   
   echo '<br />Generate regions towns cache successfully.';
 }  
